#include "CCQTControllerManager.h"


static CCQTControllerManager  s_manager;


CCQTControllerManager * CCQTControllerManager::sharedManager()
{
	return &s_manager;
}


void CCQTControllerManager::reg(QString str , AbstractPEditor *controller)
{
	m_mapControllers.insert(str , controller);
}

AbstractPEditor * CCQTControllerManager::findController( QString name )
{
	return m_mapControllers.value(name);
}

void CCQTControllerManager::unreg( QString str, AbstractPEditor* editor )
{
	 m_mapControllers.remove(str);
}

AbstractPEditor ::AbstractPEditor()
{
	//
}

AbstractPEditor ::AbstractPEditor(QWidget * parent):QWidget(parent)
{
	//
}

AbstractPEditor::AbstractPEditor( QString controllerName )
{
	if( controllerName == NULL) return;
	CCQTControllerManager::sharedManager()->reg(controllerName , this);
}

void AbstractPEditor::init()
{
	CCQTControllerManager::sharedManager()->reg(regName() , this);
}


AbstractPEditor::~AbstractPEditor()
{
	
}
